package com.situ.day10;

import java.util.ArrayList;

import org.junit.Test;

public class BaoZhaung {
	@Test
	public void test(){
		ArrayList<Integer> list  = new ArrayList<>();
		list.add(56);
		list.add(90);
		for (Integer integer : list) {
			System.out.println(integer);
		}
	}
	@Test
	public void test1() {
//		String string = 12 + "";//
		String str = 12 + "";//基本数据类型转换成字符串
		String a  =  13 + "";
		System.out.println(str + a);
		String str1 = 3.1415926 + "";
		
		String str3 = Double.toString(4.67);//第二种方法
		String str4 = Integer.toString(67);
		System.out.println(str3 + str4);
		
		String e = 45 + "";
		String e1 = Boolean.toString(true);
		
		
		String str5 = "8";
		Integer q = Integer.parseInt(str5);
		System.out.println(q);
		
		String str6 = "3.1415926";
		Double w = Double.parseDouble(str6);
		System.out.println(w);
	}
	@Test
	public void test5(){
		String str = 12 + "";
		String str1 = Double.toString(3.1415);
		
		String str2  = "14";
		Integer q    = Integer.parseInt(str2);
	}
	
	@Test
	public void test6(){
		String sre = "Java AndroidA";
		
		System.out.println(sre.lastIndexOf("n",7));
			
		}
	@Test
	public void test7(){
		String sre = "Java AndroidA";
		
		System.out.println(sre.lastIndexOf('i'));
			
		}
	
	@Test
	public void test8(){
		String sre = "Java AndroidA";
		
		System.out.println(sre.equalsIgnoreCase("java androida"));
		System.out.println(sre.equals("Java AndroidA"));
		System.out.println(sre.equalsIgnoreCase("java androidA"));
		System.out.println(sre.startsWith("Ja"));
		System.out.println(sre.endsWith("dA"));
		System.out.println(sre.isEmpty());
			
		}
	
	@Test
	public void test9() {//合并
	   char[] array = {'j', 'a', 'v', 'a', ' ', 'A', 'n', 'd'};
	   String str = new String(array);
	   System.out.println(str);// java And
	   char[] charArray = str.toCharArray();
	   for (char c : charArray) {
	     System.out.print(c + " ");
	   }
	}
	@Test
	public  void test99() {
		char[] array = {'j', 'a', 'v', 'a', ' ', 'A', 'n', 'd'};
		String str = new String(array);
		System.out.println(str);
		char[] charArray = str.toCharArray();
		for (char c : charArray) {
			System.out.print(c + " ");
		}
	}
	@Test
	public void test10() {//替换为B
	   String str = "java AndroidA";
	   System.out.println(str.replace('A', 'B'));
	}
	@Test
	public void test100() {//替换为B
		String str = "java AndroidA";
		System.out.println(str.replace("a", "b"));
	}
	
	@Test
	public void test11() {
	   String str = "java AndroidA";
	   String[] array = str.split(" ");
	   for (String string : array) {
	      System.out.println(string);
	   }
	}
	@Test
	public void test110() {
		String str = "java AndroidA";
		String[] array = str.split(" ");
		for (String string : array) {
			System.out.println(string);
		}
	}
	@Test
	public void test12() {
	   String str = "java AndroidA";
	   System.out.println(str.substring(5));//AndroidA
	   System.out.println(str.substring(5, 8));//And
	}
	@Test
	public void test13() {
	   String str = "   java Android    ";
	   System.out.println(str);//   java Android   
	   System.out.println(str.trim());//java Android

	}
	String qwe = 90 + "";
	String qwer = Double.toString(3.12);
	
	Integer integer = Integer.parseInt(qwe);
}


